package com.baturu.vin.ford.dal.dao;

import com.baturu.vin.dto.parts.PartsAssemblyDTO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.Collection;
import java.util.List;

/**
 * @Author: jiangxinlei
 * @Time: 2018-09-18 11:21
 **/
public interface FordAssemblyDAO {

    @Select({"<script>" ,
            "select distinct  assPartsName, nonAssPartsName from ford_assembly_info" ,
            "where assPartsName in ",
            "<foreach item='partsName' index='index' collection='partsNames' open='(' close=')' separator=','>" ,
            "#{partsName}" ,
            "</foreach>" ,
            "and carSystem = #{carSystem}",
            "and engineDescription = #{engineDescription}",
            "and yearRangeStart &lt;= #{yearRange}",
            "and yearRangeEnd &gt;= #{yearRange}",
            "</script>"})
    List<PartsAssemblyDTO> queryAssemblyInfo(@Param("partsNames") Collection<String> partsNames,
                                             @Param("carSystem") String carSystem,
                                             @Param("engineDescription") String engineDescription,
                                             @Param("yearRange") String yearRange);

}
